
use super::solution::Solution;
impl Solution {
    pub fn largest_good_integer(num: String) -> String {
        let byte_arr =num.into_bytes();
        let mut max=None;
        let mut item=byte_arr[0];
        let mut count=1;
        for i in 1..byte_arr.len() {
            if byte_arr[i]==item {
                count += 1;
            }else{
                count=1;
                item=byte_arr[i];
            }
            if count>=3{
                if let Some(m)=max{
                    if m>item{
                        continue
                    }
                }
                max=Some(item);
            }
        }
        if let Some(m)=max{
            String::from_utf8([m].repeat(3)).unwrap()
        }else{
            String::new()
        }


    }
}